﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace CarparkApi.Controllers
{
    public class DatetimeHelper
    {
        public static DateTime ParseOccuredDatetime(string date)
        {
            //string datePatt = @"yyyy-MM-ddTHH:mm:ss K";  //"date":"2022-11-12T11:25:23.528000+08:00",
            DateTime occ = DateTimeOffset.Parse(date).LocalDateTime;
            return occ;
        }
        /// <summary>
        /// second unit
        /// </summary>
        /// <param name="datetime"></param>
        /// <returns></returns>
        public static long ToUnixTimeSeconds(DateTime datetime)
        {
            DateTimeOffset dateTimeOffset = new DateTimeOffset(datetime);
            return dateTimeOffset.ToUnixTimeSeconds();
        }
    }
}
